package com.huawei.esdk.tp.device.terminal;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.huawei.esdk.tp.bean.terminal.ResBean;
import com.huawei.esdk.tp.bean.terminal.ResGetLocalCamListStateBean;
import com.huawei.esdk.tp.bean.terminal.ResGetMainVideoSourceListBean;
import com.huawei.esdk.tp.bean.terminal.WebCamsrcContent;
import com.huawei.esdk.tp.bean.terminal.WebComboboxContent;
import com.huawei.esdk.tp.domain.model.bean.VideoSourcesInfo;

public class TerminalResConvert
{

    public static List<VideoSourcesInfo> videoSourcesInfoListConvert(
            ResBean resBean)
    {
        List<VideoSourcesInfo> vsiList = new ArrayList<VideoSourcesInfo>(8);
        ResGetLocalCamListStateBean resGetLocalCamListStateBean = (ResGetLocalCamListStateBean) resBean
                .getDataBean();

        for (WebCamsrcContent wcc : resGetLocalCamListStateBean.getItemList())
        {
            VideoSourcesInfo vsi = new VideoSourcesInfo();
            vsi.setSourcesID(wcc.getItemID());
            vsi.setSourcesName(wcc.getSzItemName());
            vsi.setSourcesState(wcc.getItemState());
            vsiList.add(vsi);
        }
        return vsiList;
    }

    public static Map<Integer, String> mainVideoSourceListConvert(
            ResBean resBean)
    {
        Map<Integer, String> mvsMap = new HashMap<Integer, String>(8);
        ResGetMainVideoSourceListBean resGetMainVideoSourceListBean = (ResGetMainVideoSourceListBean) resBean
                .getDataBean();
        for(WebComboboxContent wcc : resGetMainVideoSourceListBean.getItemList())
        {
            mvsMap.put(wcc.getItemID(), wcc.getSzItemName());
        }
        return mvsMap;
    }
}
